﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class Authentication : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void _goButton_Click(object sender, EventArgs e)
    {
        try
        {
            AuthenticationService.AuthenticationServiceClient auth_client =
                new AuthenticationService.AuthenticationServiceClient();

            EncryptionService.ServiceSoapClient encrypt_client =
                new EncryptionService.ServiceSoapClient("ServiceSoap");

            String username = encrypt_client.Encrypt(_username.Text);
            String password = encrypt_client.Encrypt(_password.Text);

            AuthenticationService.AuthenticationResponse auth_response =
                auth_client.authenticate(username, password);

            _results.Text = auth_response.Reason;

        }
        catch (Exception ex)
        {
            String message =
                "An Exception occured in test case (TestAuthenticaitonValid). " + ex.Message;
            _results.Text = message;
        }
    }
}